package com.boot.test.controller;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.boot.test.service.DemoService;

@Controller
@RequestMapping("/test/demo")
public class DemoController {
	private @Autowired DemoService demoService;
	@RequestMapping(value="/{page}")
	public @ResponseBody Object page(@PathVariable String page,HttpServletRequest req) {	
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("code", 0);
		map.put("page", page);
		demoService.test();
		return map;
	}
	
	@RequestMapping(value="/index")
	public @ResponseBody Object index(HttpServletRequest req) {	
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("code", 0);
		demoService.test();
		return map;
	}
}
